<#include "../comm/_layout.html"/>
<style type="text/css">
#postList {
	width: 100%;
	height: 80%;
	float: left;
}

#postAdd {
	width: 100%;
	height: 20%;
	background-color: #fff;
	float: left;
}

table {
	color: #333;
	border-color: #fff;
	width: 100%;
}

.tdd:hover {
	background: #f55;
}
</style>
<@layout>

<script type="text/javascript">
$(document).ready(function(){
		$("#save").click(function(){
		if($("#content").val()==""){
			alert("内容不能为空");
		}else{
	 		var objStr='{"authorId":'
	 			+${session.sessionUser.id!1}
	 			+',"content":'
	 			+$("#content").val()
	 			+',"pId":'
	 			+${post.id!}
	 			+'}';
	 			
		$.ajax({
		type:'post',
		url:'${ctx_path}/p/saveComent',
		data:{ objStr:objStr},
		dataType:'json',
		success:function(msg){
				if(msg=="0"){
					alert("评论失败");		
				}else{
					window.location="${ctx_path}/p/coment/${post.id!}";
				}
			}
		}) 
		}	
		});
});
</script>

<#if session.sessionUser??>
<h3>
	当前登录：${session.sessionUser.phone!}&nbsp|&nbsp<a href="${ctx_path}/u/logout">注销</a>
</h3>
<#else> </#if>


<div id="postAdd">
	<h1>秘密内容</h1>
	<label style="color: #f55">${post.content!};</label> 
</div>

<div id="comentList">
	<h1>评论列表</h1><input type="text" id="content" /> <input type="button" id="save" value="发表评论" />
	<table border="1">
		<tr>
			<th>序号</th>
			<th>回帖人</th>
			<th>头像</th>
			<th>评论内容</th>
			<th>评论时间</th>
			<th>帖子编号</th>
		</tr>
		<#list coments as coment>
		<tr class="tdd">
			<td>${coment_index+1}</td>
			<td>${coment.authorId!}</td>
			<td><img src="${coment.head!}"/></td>
			<td>${coment.content!}</td>
			<td>${coment.createTime!}</td>
			<td>${coment.pId!}</td>
		</tr>
		</#list>
	</table>
</div>
</@layout>



